<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<div class="page-content">
	<!--content-->
	<div class="panel panel-default oparePanel">
		<div class="panel-body">
			<div class="searchBox">

			</div>

			<div class="opare">
				<input type="button" id="addBtn" value="+" class="btn_add" onclick="menuUrl('menu/view', 'menu:add');"/>
				<input type="button" value="刷新缓存" class="btn" onclick="menu.reloadCache();">
			</div>

		</div>
	</div>

	<div class="portlet-body">
		<div class="table-scrollable">
			
			 <table class="table tree  table-striped table-condensed">
			 
			    <thead class="flip-content">
					<tr>
						<th width="15%">权限名称</th>
						<th width="10%">编码</th>
						<th width="10%">权限类型</th>
						<th width="35%">uri</th>
						<th width="30%" class="text-center">操作</th>
					</tr>
				</thead>
				<tbody id="select_tbody">
	               <c:set var="index" value="0"></c:set>
	               <c:if test="${result.code eq 'SUCCESS' }">
					     <c:forEach items="${result.data}" var ="root" varStatus="status">
					        <c:set var="index" value="${index + 1 }"></c:set>
					        <c:set var="parent" value="${index }"></c:set>
					        <tr class="treegrid-${index}">
								
								<c:choose>  
								   <c:when test="${root.status eq '1'}"> 
								     <td width="15%" class="">${root.name }</td>
								   </c:when>  
								   <c:otherwise>  
								   <td width="15%" class="">${root.name }<font color="red">[已删除] </font>  </td>
								   </c:otherwise>  
								</c:choose>  
								
								<td width="10%" class="">${root.code }</td>
								<td width="10%" class="">
                                  <c:if test="${root.resType == 1 }">
                                                                                     菜单
                                  </c:if>
                                  <c:if test="${root.resType == 2 }">
                                                                                     按钮
                                  </c:if>
                                </td>
								<td width="35%" class="">${root.uri }</td>
								<td width="30%" class="text-center">
									<a href="javascript:;" onclick="menu.dele('${root.id}');" class="a-delet">删除</a>
									<a href="javascript:;" onclick="updateShow('menu/view', 'menu:modify','${root.id}');" class="a-modefiy">修改</a>
									<a href="javascript:;" onclick="detailShow('menu/view', 'menu:detail','${root.id}');" class="a-detial">详情</a>
								</td>
			                </tr>
					        <c:if test="${! empty root.childList }">
					    		 <c:forEach items="${root.childList}" var ="second" varStatus="statusSecond">
					    		     
					    		     <c:set var="index" value="${index + 1 }"></c:set>
					    		     <c:set var="subParent" value="${index }"></c:set>						    		     
					    		     <tr class="treegrid-${index} treegrid-parent-${parent }">
									
										<c:choose>  
										   <c:when test="${second.status eq '1'}"> 
										     <td width="15%" class="">${second.name }</td>
										   </c:when>  
										   <c:otherwise>  
										   	<td width="15%" class="">${second.name }<font color="red">[已删除] </font>  </td>
										   </c:otherwise>  
										</c:choose>  
										
										<td width="10%" class="">${second.code }</td>
										<td width="10%" class="">
		                                  <c:if test="${second.resType == 1 }">
		                                                                                     菜单
		                                  </c:if>
		                                  <c:if test="${second.resType == 2 }">
		                                                                                     按钮
		                                  </c:if>
		                                </td>
										<td width="35%" class="">${second.uri }</td>
										<td width="30%" class="text-center">
											<a href="javascript:;" onclick="menu.dele('${second.id}');" class="a-delet">删除</a>
											<a href="javascript:;" onclick="updateShow('menu/view', 'menu:modify','${second.id}');" class="a-modefiy">修改</a>
											<a href="javascript:;" onclick="detailShow('menu/view', 'menu:detail','${second.id}');" class="a-detial">详情</a>
										</td>
									</tr>
									
								   	<c:if test="${! empty second.childList }">
						    		 <c:forEach items="${second.childList}" var ="three" varStatus="statusthree">
						    		        
						    		        <c:set var="index" value="${index + 1 }"></c:set>
						    		     	<tr class="treegrid-${index} treegrid-parent-${subParent }">
										
											<c:choose>  
											   <c:when test="${three.status eq '1'}"> 
											     <td width="15%" class="">${three.name }</td>
											   </c:when>  
											   <c:otherwise>  
											   	<td width="15%" class="">${three.name }<font color="red">[已删除] </font>  </td>
											   </c:otherwise>  
											</c:choose>  
											
											<td width="10%" class="">${three.code }</td>
											<td width="10%" class="">
			                                  <c:if test="${three.resType == 1 }">
			                                                                                     菜单
			                                  </c:if>
			                                  <c:if test="${three.resType == 2 }">
			                                                                                     按钮
			                                  </c:if>
			                                </td>
											<td width="35%" class="">${three.uri }</td>
											<td width="30%" class="text-center">
												<a href="javascript:;" onclick="menu.dele('${three.id}');" class="a-delet">删除</a>
												<a href="javascript:;" onclick="updateShow('menu/view', 'menu:modify','${three.id}');" class="a-modefiy">修改</a>
												<a href="javascript:;" onclick="detailShow('menu/view', 'menu:detail','${three.id}');" class="a-detial">详情</a>
											</td>
										</tr>
						    		  </c:forEach>
						        	</c:if>
									
					    		 </c:forEach>
					        </c:if>
					     </c:forEach>
				   </c:if>
	            </tbody>
	          </table>   
	               
		</div>
	</div>
    <script type="text/javascript">
   
       $('.tree').treegrid({
           expanderExpandedClass:"treegrid-expander-expanded",
           expanderCollapsedClass: "treegrid-expander-collapsed"
       });

    </script>
	<!--end content-->
	<div class="clearfix"></div>
</div>



<div class="clearfix"></div>
